package com.example.administrator.shzs.ui;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.example.administrator.shzs.app.MyApplication;
import com.example.administrator.shzs.R;
import com.example.administrator.shzs.utils.ToastUtils;
import com.example.administrator.shzs.activity.BaseActivity;
import butterknife.Bind;
import butterknife.ButterKnife;


/**
 * 建议或意见
 */
public class IdeaActivity extends BaseActivity {


    @Bind(R.id.et_idea)
    EditText etIdea;
    @Bind(R.id.et_phone)
    EditText etPhone;
    @Bind(R.id.btn_submit)
    Button btnSubmit;
    @Bind(R.id.tv_call_phone)
    TextView tvCallPhone;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_idea);
        ButterKnife.bind(this);
        MyApplication.app.activityList.add(this);

        btnSubmit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {


                String idea = etIdea.getText().toString().trim();
                String phone = etPhone.getText().toString().trim();

                if(!idea.equals("")) {
                    Log.e("Life", "反馈" + idea + "  ,手机号码: " + phone);
                    ToastUtils.showMessageLong(IdeaActivity.this, "提交成功,感谢您宝贵的建议!");
                    finish();
                }else {
                    ToastUtils.showMessageShort(IdeaActivity.this, "请输入详细的意见和建议再提交");
                }
            }
        });


        tvCallPhone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + 8820666));
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);

            }
        });
    }
}
